import battlegui.*;

/**
 * The test class BattleGroundTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class BattleGroundTest extends junit.framework.TestCase
{
    /**
     * Default constructor for test class BattleGroundTest
     */
    public BattleGroundTest()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    protected void setUp()
    {
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    protected void tearDown()
    {
    }

	public void testHowManySheds()
	{
		BattleGround battleGr1 = new BattleGround(10, 10);
		assertEquals(4, battleGr1.howManySheds());
	}
	
	public void testPlaceShed()
	{
	    BattleGround battleGr1 = new BattleGround(10, 10);
	    Player player1 = new Player("Mathieu", PlayerID.HUMAN_PLAYER_1); 
	    Shed shed1 = new Shed(4, Orientation.VERTICAL, player1);
	    assertEquals("Your shed is succesfully placed !", battleGr1.placeShed(shed1, new Position(5,5)));
	    assertEquals("Your shed is succesfully placed !", battleGr1.placeShed(shed1, new Position(4,5)));
	    assertEquals("You are not allowed to place a shed with :\n - orientation : " + "VERTICAL" + "\n - size : " + "4", battleGr1.placeShed(shed1, new Position(5,2)));
	    assertEquals("You are not allowed to place a shed with :\n - orientation : " + "VERTICAL" + "\n - size : " + "4", battleGr1.placeShed(shed1, new Position(4,7)));
	}
	
	public void testShot()
	{
	    BattleGround battleGr1 = new BattleGround(10, 10);
	    Player player1 = new Player("Mathieu", PlayerID.HUMAN_PLAYER_1); 
	    Shed shed1 = new Shed(4, Orientation.VERTICAL, player1);
	    battleGr1.placeShed(shed1, new Position(5,5));
	    boolean[] test = new boolean[2]; test[0] = true; test[1] = false;
	    boolean[] test2 = new boolean[2];
	    test2 = battleGr1.shot(new Position(6,5));
	    assertEquals(test[0], test2[0]); assertEquals(test[1], test2[1]);
	    test[0] = false; test[1] = false;
	    test2 = battleGr1.shot(new Position(6,5));
	    assertEquals(test[0], test2[0]); assertEquals(test[1], test2[1]);
	    test[0] = true; test[1] = true;
	    test2 = battleGr1.shot(new Position(5,7));
	    assertEquals(test[0], test2[0]); assertEquals(test[1], test2[1]);
	}
}



